x11: Add debug toggle for preferring GLX
authorEmmanuele Bassi <ebassi@gnome.org>
Mon, 10 May 2021 17:36:32 +0000 (18:36 +0100)
committerEmmanuele Bassi <ebassi@gnome.org>
Mon, 10 May 2021 19:44:35 +0000 (20:44 +0100)
Mostly as a way to compare the EGL and GLX implementations.

gdk/gdk.c
gdk/gdkdebug.h
gdk/x11/gdkglcontext-x11.c

index 5cd0e1922d1dd960735d12662930ea42c1c5312a..0970cbc8d1ac54d7ad07e082a8ff8e5fcc614ccc 100644 (file)
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -126,6 +126,7 @@ static const GdkDebugKey gdk_debug_keys[] = {
   { "gl-legacy",       GDK_DEBUG_GL_LEGACY, "Use a legacy OpenGL context" },
   { "gl-gles",         GDK_DEBUG_GL_GLES, "Use a GLES OpenGL context" },
   { "gl-debug",        GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL" },
+  { "gl-glx",          GDK_DEBUG_GL_GLX, "Use GLX on X11" },
   { "vulkan-disable",  GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support" },
   { "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer" },
   { "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings" },
index 2098774739bd39dd2d9a849fdf0a7e82243956d2..e03b904ce4018325ef63b5e3013a2cc8d2ec8bfe 100644 (file)
@@ -41,9 +41,10 @@ typedef enum {
   GDK_DEBUG_GL_LEGACY       = 1 << 15,
   GDK_DEBUG_GL_GLES         = 1 << 16,
   GDK_DEBUG_GL_DEBUG        = 1 << 17,
-  GDK_DEBUG_VULKAN_DISABLE  = 1 << 18,
-  GDK_DEBUG_VULKAN_VALIDATE = 1 << 19,
-  GDK_DEBUG_DEFAULT_SETTINGS= 1 << 20
+  GDK_DEBUG_GL_GLX          = 1 << 18,
+  GDK_DEBUG_VULKAN_DISABLE  = 1 << 19,
+  GDK_DEBUG_VULKAN_VALIDATE = 1 << 20,
+  GDK_DEBUG_DEFAULT_SETTINGS= 1 << 21
 } GdkDebugFlags;
 
 extern guint _gdk_debug_flags;
index 1d9f5675df764a1276c05d991fb7d0d71a3c0462..9f7fc893431e0906f24bc9efd6adb630fa5f2778 100644 (file)
@@ -238,9 +238,12 @@ gdk_x11_screen_init_gl (GdkX11Screen *screen)
   if (GDK_DISPLAY_DEBUG_CHECK (display, GL_DISABLE))
     return FALSE;
 
-  /* We favour EGL */
-  if (gdk_x11_screen_init_egl (screen))
-    return TRUE;
+  if (!GDK_DISPLAY_DEBUG_CHECK (display, GL_GLX))
+    {
+      /* We favour EGL */
+      if (gdk_x11_screen_init_egl (screen))
+        return TRUE;
+    }
 
   if (gdk_x11_screen_init_glx (screen))
     return TRUE;